<template>
  <div class="footer-page">
    <div class="details_page">
      <div class="top flex flex-between align-center">
        <div class="top_left">
          <img src="../../assets/images/tip-icon.png" alt="tip">
          <span>工单状态：
            {{ suggestInfo.status == 1 ? "待处理" : suggestInfo.status == 2 ? "处理中" : suggestInfo.status == 3 ? "已处理" : suggestInfo.status == 4 ? "已撤销" : "已超时" }}
          </span>
        </div>
        <div class="top_right">
          <el-button v-if="suggestInfo.status != '3'" class="btns" size="small" type="warning" @click="intervene(suggestInfo.id)">介入</el-button>
          <el-button class="btns" size="small" type="primary" @click="remark(suggestInfo.id)">备注</el-button>
        </div>
      </div>
      <div class="bottom_info">
        <div class="orderInfo">
          <div class="mar20">
            <img src="../../assets/images/xcx.png" alt="icon">
            <span class="orderInfo_title">订单信息</span>
          </div>
          <div class="orderInfo_left">
            <div>
              <p>
                <span style="margin-left: 14px;">工单号：</span>
                <span>{{ suggestInfo.work_order }}</span>
              </p>
              <p>
                截止时间：
                <span>{{ suggestInfo.end_time }}</span>
              </p>
              <p>
                联系手机：
                <span>{{ suggestInfo.user_mobile }}</span>
              </p>
            </div>
          </div>
          <div class="orderInfo_right">
            <div>
              <p>创建时间：
                <span>{{ suggestInfo.create_time }}</span>
              </p>
              <p>工单等级：
                <span>{{ suggestInfo.grade == 1 ? "普通" : suggestInfo.grade == 2 ? "紧急" : "严重" }}
                </span>
              </p>
            </div>
          </div>
        </div>
        <div class="orderGoods">
          <div class="mar20">
            <img src="../../assets/images/xcx.png" alt="icon">
            <span class="orderInfo_title">详情说明</span>
          </div>
          <div class="explain">
            <p>投诉类型：
              <span class="red-font">{{ suggestInfo.suggest_type }}</span>
            </p>
            <p>投诉类别：
              <span class="red-font">
                {{ suggestInfo.suggest_cate == 1 ? "商品名称" : suggestInfo.suggest_cate == 2 ? "商家名称" : "订单编号" }}
              </span>
            </p>
            <p>
              类别内容：<span class="red-font">{{ suggestInfo.suggest_title }}</span>
            </p>
            <p>
              详细说明：<span class="red-font">{{ suggestInfo.content }}</span>
            </p>
            <div>
              <preview-img v-for="(item, index) in imgList" :key="index" :img-url="item" />
              <!-- <img
                v-for="(item, index) in imgList"
                :key="index"
                class="refundImg"
                :src="$globalObj.imgBaseUrl + item"
                alt="img"
              /> -->
            </div>
          </div>
        </div>
        <div class="orderRecords">
          <div class="mar20">
            <img src="../../assets/images/xcx.png" alt="icon">
            <span class="orderInfo_title">投诉进度记录</span>
          </div>
          <el-table :data="suggestList">
            <el-table-column label="内容" prop="operator_content" />
            <el-table-column label="操作人" prop="operator" />
            <el-table-column label="时间" prop="create_time" />
          </el-table>
        </div>
      </div>
    </div>
    <div slot="footer" class="dialog-footer setBtn">
      <el-button type="primary" @click="toClose()">关闭</el-button>
    </div>
    <dispose ref="disposes" :suggest-id="suggestId" />
    <note-records ref="noteRecord" :suggest-id="suggestId" />
  </div>
</template>

<script>
import { lookDetail } from '@/api/complaint'
import dispose from './dailog/dispose'
import noteRecords from './dailog/noteRecords'
import previewImg from '@/components/previewImg'

export default {
  // props: ['id'],
  components: { dispose, noteRecords, previewImg },
  props: {
    id: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      suggestInfo: {},
      suggestList: [],
      imgList: [],
      suggestId: ''
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      lookDetail(this.id).then((res) => {
        this.suggestInfo = res.suggest
        this.suggestList = res.suggestLog
        this.imgList = res.suggest.images ? res.suggest.images.split(',') : []
      })
    },
    toClose() {
      this.$router.go(-1)
    },
    intervene(id) {
      this.suggestId = id
      this.$refs.disposes.dialogVisible = true
    },
    remark(id) {
      this.suggestId = id
      this.$refs.noteRecord.dialogVisible = true
    }
  }
}
</script>

<style lang="scss" scoped>
.footer-page {
  padding-bottom: 0;
}

img {
  vertical-align: middle;
  margin-right: 17px;
}

.mar20 {
  margin-bottom: 20px;
}

.details_page {
  border: 1px solid #e6e6e6;

  .top {
    height: 80px;
    background: #f5f5f5;
    padding: 0 12px 0 25px;

    .top_left {
      img {
        width: 36px;
        height: 36px;
      }

      span {
        font-size: 22px;
        font-weight: bold;
        color: #ff4247;
        vertical-align: middle;
      }
    }
    .top_right {
      .btns {
        height: 40px;
        border-radius: 3px;
      }
    }
  }

  .bottom_info {
    padding: 30px 30px 80px;

    .orderGoods {
      margin-bottom: 30px;

      .goodsImg {
        width: 50px;
        height: 50px;
        float: left;
      }

      .p1 {
        color: #2891fb;
      }

      .p2 {
        color: #999999;
      }

      .explain {
        border: 1px solid #e6e6e6;
        padding: 20px;

        p {
          line-height: 35px;
        }

        div {
          padding-left: 70px;
          margin-top: 5px;
        }

        img {
          width: 90px;
          height: 90px;
        }
      }
    }

    .orderInfo {
      height: 180px;

      .orderInfo_title {
        font-size: 16px;
        color: #666666;
        vertical-align: middle;
      }

      p {
        line-height: 35px;
      }

      .orderInfo_left,
      .orderInfo_right {
        width: 50%;
        float: left;
      }

      .checkBtn {
        margin-left: 15px;
      }
    }
  }
}

.setBtn {
  text-align: center;
  margin-top: 30px;
  //   border-top: 1px solid #eee;
  height: 70px;
  line-height: 70px;
}

/deep/.preview_img {
  display: inline-block;
  padding-left: 0 !important;
  margin-right: 10px;
}
</style>
